# coding:utf-8

import re


def check_url(url):
    result = re.findall('[a-zA-Z]{4,5}://\w*\.*\w+\.\w+', url)
    if len(result):
        return True
    else:
        return False


def get_url(url):
    result = re.findall('[http://|https://](\w*\.*\w+\.\w+)', url)
    if len(result) != 0:
        return result[0]
    else:
        return ''


def get_email(data):
    # 18866545703@163.com
    result = re.findall('[0-9a-zA-Z_]+@[0-9a-zA-Z]+\.[a-zA-Z]+', data)
    if len(result):
        return True
    else:
        return False


def get_html_data(data):
    result = re.findall('style="(.*?)"', data)
    return result


def get_common_element(data):
    result = re.findall('="(.+?)"', data)
    return result


if __name__ == '__main__':
    html = ('<div class="s-top-nav nav-bload" style="display:none;">'
            '</div><div class="s-center-box"></div>')
    result = get_common_element(html)
    print(result)
